/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package bookingsystem;

import java.sql.*;

/**
 *
 * @author Domek
 */
public class DBConnection {
    String driverName = "com.mysql.jdbc.Driver";
    String serverName = "127.0.0.1";
    String portNumber = "3306";
    String sid = "centraldb";
    String username = "root";
    String password = "*roki2002#";
    Connection connection = null;
    public Connection getConnection(String sid, String ip){
        try {
            String url = "jdbc:mysql://" + ip + ":" + portNumber + "/" + sid;
            Class.forName(driverName); // Create a connection to the database
            connection = DriverManager.getConnection(url, username, password);
        }
        catch (ClassNotFoundException e) { // Could not find the database driver
        }
        catch (SQLException e){
        }
        return connection;
    }
}
